package Tester;

import org.junit.Test;

import static org.junit.Assert.*;

import spaceCraft.Engine;
import spaceCraft.ProductInfo;

/**
 * Created by IntelliJ IDEA.
 * User: anton
 * Date: 23.03.12
 * Time: 18:14
 * To change this template use File | Settings | File Templates.
 */
public class EngineTest {

    private int acceleration = 9000;

    @Test
    public void breakEngineTest() {
        Engine sorryEngine = new Engine(new ProductInfo("ZAZ", "966"), acceleration);
        sorryEngine.breakDevice();
        assertFalse(sorryEngine.isInWorkCondition());
    }

    @Test
    public void repairEngineTest() {
        Engine sorryEngine = new Engine(new ProductInfo("Smart", "966"), acceleration);
        sorryEngine.breakDevice();
        sorryEngine.repairDevice();
        assertTrue(sorryEngine.isInWorkCondition());
    }

    @Test
    public void getVelocityTest() {
        Engine simpleEngine = new Engine(new ProductInfo("WRX-STI", "WU"), acceleration);
        assertEquals(simpleEngine.getAcceleration(), acceleration);
    }

    @Test
    public void testExtractingInfo() {
        ProductInfo infa = new ProductInfo("Tefal", "toster");
        String coolInfa = (infa.getName() + " was made by " + infa.getManufacturer());
        Engine sorryEngine = new Engine(infa, acceleration);
        assertTrue(sorryEngine.getProductInfo().contains(coolInfa));
    }
}
